---
title: Run the monitoring agent in DataRobot
description: Run the monitoring agent within the DataRobot platform, one instance per prediction environment.
section_name: MLOps
maturity: public-preview
platform: cloud-only

---

# Run the monitoring agent in DataRobot {: #run-the-monitoring-agent-in-datarobot }

!!! info "Availability information"
    The monitoring agent in DataRobot is off by default. Contact your DataRobot representative or administrator for information on enabling this feature.

    <b>Feature flag:</b> Enable the Monitoring Agent in DataRobot

The [monitoring agent](monitoring-agent/index) typically runs outside of DataRobot, reporting metrics from a [configured spooler](spooler) populated by calls to the DataRobot MLOps library in the external model's code. Now available for public preview, you can run the monitoring agent _inside_ DataRobot by creating an [external prediction environment](pred-env) with an external spooler's credentials and configuration details.

To create a prediction environment associated with an external spooler:

1. Click **Deployments > Prediction Environments** and then click **Add prediction environment**.

    ![](images/pred-env-3.png)

2. In the **Add prediction environment** dialog box, complete the following fields:

    ![](images/agent-in-dr-basic-info.png) 

    Field       | Description
    ------------|------------
    Name        | Enter a descriptive prediction environment name.
    Description | _Optional_. Enter a description of the external prediction environment.
    Platform    | Select the external platform on which the model is running and making predictions.

3. Under **Supported model formats**, select one or more formats to control which models can be deployed to the prediction environment, either manually or using the management agent. The available model formats are [**DataRobot**](build-models/index) or [**DataRobot Scoring Code only**](scoring-code/index), [**External Model**](ext-model-prep/index), and [**Custom Model**](custom-models/index).

    ![](images/agent-in-dr-model-format.png) 

    !!! important
        You cannot select both **DataRobot** and **DataRobot Scoring Code only**.

4. Under **Managed by**, select **Managed by DataRobot**. The following options are provided:

    ![](images/agent-in-dr-managed-by.png) 

    Option                      | Description
    ----------------------------|------------
    Self-managed                | Manually manage models on your infrastructure and report data manually to DataRobot.
    Managed by Management Agent | Manage models with the [Management Agent](mgmt-agent/index) on your own infrastructure.
    Managed by DataRobot        | Manage models with the [Management Agent](mgmt-agent/index) inside DataRobot. This option is only available if the **Platform** selected is [**Azure**](azureml-sc-deploy-replace) or [**Snowflake**](pp-snowflake-sc-deploy-replace).

5. Under **Settings**, select a **Queue**: 

    === "Amazon SQS"

        Select the **AWS S3 Credentials** for your Amazon SQS spooler and configure the following Amazon SQS fields:

        ![](images/agent-in-dr-sqs.png) 
  
        Field              | Description
        -------------------|-------------
        Region             | Select the AWS region used for the queue.         
        SQS Queue URL      | Select the URL of the SQS queue used for the spooler.    
        Visibility timeout | _Optional_. The [visibility timeout](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html){ target=_blank } before the message is deleted from the queue. This is an Amazon SQS configuration not specific to the monitoring agent.

        After you configure the **Queue** settings you can provide any **Environment variables** accepted by the Amazon SQS spooler. For more information, see the [Amazon SQS spooler reference](spooler#amazon-sqs).
    
    === "Google Pub/Sub"

        ![](images/agent-in-dr-pub-sub.png) 

        Select the **GCP Credentials** for your Google Pub/Sub spooler and configure the following Google Pub/Sub fields:
  
        Field                | Description
        ---------------------|-------------
        Pub/Sub project      | Select the Pub/Sub project used by the spooler.  
        Pub/Sub topic        | Select the Pub/Sub topic used by the spooler; this should be the topic name within the project, not the fully qualified topic name path that includes the project ID. 
        Pub/Sub subscription | Select the Pub/Sub subscription name of the subscription used by the spooler.
        Pub/Sub acknowledgment deadline | _Optional_. Enter the amount of time (in seconds) for subscribers to process and acknowledge messages in the queue.

        After you configure the **Queue** settings you can provide any **Environment variables** accepted by the Google Pub/Sub spooler. For more information, see the [Google Cloud Pub/Sub spooler reference](spooler#google-cloud-pubsub).

    === "Azure Event Hubs"

        Select the Azure Service Principal **Credentials** for your Azure Event Hubs spooler and configure the **Azure Subscription** and **Azure Resource Group** fields accessible using the provided **Credentials**:

        ![](images/agent-in-dr-azure.png) 

        ??? note "Azure Service Principal credentials required"
            DataRobot management of Scoring Code in AzureML requires existing Azure Service Principal **Credentials**. If you don't have existing credentials, the **Azure Service Principal credentials required** alert appears, directing you to **Go to Credentials** to [create Azure Service Principal credentials](stored-creds).

            ![](images/azure-create-connection-alert.png)

            To create the required credentials, for **Credential type**, select **Azure Service Principal**. Then, enter a **Client ID**, **Client Secret**, **Azure Tenant ID**, and a **Display name**. To validate and save the credentials, click **Save and sign in**.

            ![](images/azure-credentials.png)

            You can find these IDs and the display name on Azure's **App registrations > Overview** tab (1). You can generate secrets on the [**App registration > Certificates and secrets** tab](https://learn.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app#add-credentials){ target=_blank }(2):

            ![](images/get-azure-credentials.png)

        Next, configure the following Azure Event Hubs fields:

        ![](images/agent-in-dr-event-hubs.png) 

        Field                | Description
        ---------------------|-------------
        Event Hubs Namespace | Select a valid [Event Hubs namespace](https://learn.microsoft.com/en-us/azure/event-hubs/event-hubs-create#create-an-event-hubs-namespace){ target=_blank } retrieved from the Azure Subscription ID.
        Event Hub Instance   | Select an [Event Hubs instance](https://learn.microsoft.com/en-us/azure/event-hubs/event-hubs-create#create-an-event-hub){ target=_blank } within your namespace for monitoring data.

        After you configure the **Queue** settings, you can provide any **Environment variables** accepted by the Azure Event Hubs spooler. For more information, see the [Azure Event Hubs spooler reference](spooler#azure-event-hubs).

6. Once you configure the environment settings, click **Add environment**.

    The environment is now available from the **Prediction Environments** page.

## Manage an agent-monitored prediction environment {: #manage-an-agent-monitored-prediction-environment }

When you add a prediction environment with monitoring settings configured, you can view the health and status of that prediction environment, edit the queue settings, and stop or start the agent. On the **Deployments > Prediction Environments** tab, locate the agent-monitored and managed environment. From the prediction environment inventory, you can view the **Name**, **Platform**, **Added On** date, **Created By** date, and **Health**. You can also edit, share, and delete prediction environments. For more information, see the [Manage prediction environments](pred-env-manage) documentation.

!!! tip "Copy prediction environment ID"
    From the upper-left corner of either tab in a prediction environment, you can click the copy icon (:fontawesome-solid-copy:{.lg}) to copy the **Prediction Environment ID**.

From the **Details** tab, you can edit the prediction environment **Name**, **Description**, **Platform**, **Supported model formats**, **Managed by** setting, and associated **Service Account**. In the **Usages** section, you can view and access deployments associated with the environment:

![](images/agent-in-dr-details.png) 

!!! note "Deployment links"
    Deployment links are only provided for deployments you have access to.

From the **Monitoring** tab, you can edit the **Settings** configured when creating the environment to modify the connection between the monitoring agent and the spooler. The agent **Status** must be inactive to edit these settings:

![](images/agent-in-dr-monitoring-settings.png) 

From the **Monitoring Agent** section, you can view agent status information, enable or disable the agent, view prediction records, and view or download logs:

![](images/agent-in-dr-monitoring-status.png) 

